<template>
  <div class="window_loading">
    <div class="messagebox">
      <svg class="icon" aria-hidden="true">
        <use :xlink:href="'#'+icon" />
      </svg>
      <span>{{msg}}</span>
    </div>
  </div>
</template>
<script>
export default {
  props: ["msg", "status"],
  data() {
    return {
      icon: ""
    };
  },
  mounted() {
    switch (this.status) {
      case "success":
        this.icon = "iconchenggong2";
        break;
      case "warning":
        this.icon = "iconjinggao1";
        break;
      case "error":
        this.icon = "iconcuowu1";
        break;
      default:
        this.icon = "iconchenggong2";
        break;
    }
    window.document.body.style.overflow = "hidden";
  },
  destroyed() {
    window.document.body.style.overflow = "visible";
  }
};
</script>
<style lang="scss">
@media screen and (min-width: 1200px) {
  .window_loading {
    box-sizing: border-box;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.15);
    .messagebox {
      box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.3);
      padding: 10px 20px;
      background-color: #fff;
      border-radius: 5px;
      position: absolute;
      top: 40%;
      left: 50%;
      margin-left: -60px;
      display: flex;
      justify-content: center;
      align-items: center;
      color: rgba(0, 0, 0, 0.7);
      .icon {
        margin-right: 10px;
        width: 16px;
        height: 16px;
      }
    }
  }
}
@media screen and (max-width: 1200px) and (min-width: 992px) {
}
@media screen and (max-width: 992px) and (min-width: 768px) {
}
@media screen and (max-width: 768px) and (min-width: 576px) {
}
@media screen and (max-width: 576px) {
  .window_loading {
    box-sizing: border-box;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    .messagebox {
      box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.15);
      padding: 10px 20px;
      background-color: #fff;
      border-radius: 5px;
      display: flex;
      justify-content: center;
      align-items: center;
      color: rgba(0, 0, 0, 0.7);
      .icon {
        margin-right: 10px;
        width: 16px;
        height: 16px;
      }
    }
  }
}
</style>